home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / user / fixturesleft.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  4KB  |  161 lines

  1. /* Mode=Run */
  2. /* ***********************************************************************
  3.  
  4.    DISPLAY FIXTURES LEFT PROGRAM FOR FOOTBALL REXX SUITE
  5.   -------------------------------------------------------
  6.                    Copyright  Mark Naughton 1998
  7.  
  8.  
  9. Version    Date     History
  10. --------------------------------------------------------------------------
  11.  1.0       140498   First release.
  12.  1.1       050599   Updated to handle odd number of times each team is
  13.                     played - displays a message; but only if its not
  14.                     scheduled using a schedule file.
  15.            250899   Added error msg for file checks.
  16.            280899   Converted to use locale. Some error messages, before
  17.                     reading the locale, will still be in English.
  18.  
  19. **************************************************************************
  20.  
  21. Procedure
  22. ---------
  23.  
  24. 1. Check files exist. Read '.df' file for schedule and numplay settings.
  25. 2. Open Teams.sf datafile. Get league name.
  26. 3. Search for unplayed matches and store.
  27. 4. Print the matches and exit...
  28.  
  29. ************************************************************************** */
  30. PARSE ARG league_stuff
  31.  
  32. version      = 1
  33. input_file   = '.sf'
  34. input2_file  = '.df'
  35. separator    = '*'
  36. separator2   = '**'
  37. games.       = '???'
  38. mtch         = 0
  39. not_played   = '__   __'
  40. autosched    = "*AUTOSCHD="
  41. autos        = 0
  42. numplay      = 0
  43. oddnums      = "1 3 5 7 9"
  44.  
  45.  
  46. parse var league_stuff league_file
  47. league_file = "Data/" || league_file
  48.  
  49. if open(datafile,"Data/Football.locale",'r') then do
  50.    line = readln(datafile)
  51.    locdir = strip(line)
  52.    close(datafile)
  53. end
  54. else do
  55.    say
  56.    say "ERROR :    (FixturesLeft)"
  57.    say
  58.    say "Cannot read 'Data/Football.locale' for the locale settings."
  59.    exit
  60. end
  61.  
  62. locdir = locdir"User/FixturesLeft.data"
  63.  
  64. if open(datafile,"ENV:FootballRXPath",'r') then do
  65.    line = readln(datafile)
  66.    rxdir = strip(line)
  67.    close(datafile)
  68. end
  69. else
  70.    rxdir = "SYS:Rexxc/"
  71.  
  72. if exists(locdir) > 0 then do
  73.   address command rxdir'rx 'locdir
  74.   VarCount = getclip('VarCount')
  75.   do i = 1 to VarCount
  76.     interpret getclip('var.'i)
  77.   end
  78. end
  79. else do
  80.    say
  81.    say "ERROR :    (FixturesLeft)"
  82.    say
  83.    say "Cannot find '"locdir"' to read locale settings."
  84.    exit
  85. end
  86.  
  87. if exists(league_file || input_file) = 0  then do
  88.    say
  89.    say fl_error
  90.    say
  91.    say fl_one"'"league_file || input_file"'."
  92.    exit
  93. end
  94.  
  95. if exists(league_file || input2_file) = 0  then do
  96.    say
  97.    say fl_error
  98.    say
  99.    say fl_one"'"league_file || input2_file"'."
  100.    exit
  101. end
  102.  
  103. if open(datafile2,league_file || input2_file,'r') then do
  104.    do while ~eof(datafile2)
  105.       line = readln(datafile2)
  106.       if pos(playeo,line) > 0 then
  107.          numplay = delstr(line,1,12)
  108.       if pos(autosched,line) > 0 then
  109.          autos = 1
  110.    end
  111.    close(datafile2)
  112. end
  113. else do
  114.    say
  115.    say fl_error
  116.    say
  117.    say fl_two"'"league_file || input2_file"'."
  118.    exit
  119. end
  120.  
  121. if open(datafile,league_file || input_file,'r') then do
  122.    do while ~eof(datafile)
  123.       line = readln(datafile)
  124.       if pos(separator2,line) > 0 then
  125.          league_title = delstr(line,1,3)
  126.       if pos(not_played,line) > 0 then do
  127.          mtch = mtch + 1
  128.          games.mtch = line
  129.       end
  130.    end
  131.    close(datafile)
  132. end
  133. else do
  134.    say
  135.    say fl_error
  136.    say
  137.    say fl_three"'"league_file||input_file"'"fl_four
  138.    exit
  139. end
  140.  
  141. say
  142. say center("'"league_title"'",78)
  143. say "-------------------------------------------------------------------------------"
  144. say
  145. if autos = 0 & pos(numplay,oddnums) > 0 then do
  146.    say fl_txt1
  147.    say fl_txt2
  148.    say fl_txt3
  149.    say
  150. end
  151. say fl_txt4""mtch
  152. say
  153. do i=1 to mtch
  154.    say games.i
  155. end
  156. say
  157. say
  158. say "-------------------------------------------------------------------------------"
  159. say
  160.  
  161. exit